package vld

import (
	sqlc "bp/db/sqlc"
	"bp/internal/util"
)

// IsOfferUseScene check string is em_offer_use_scene
func IsOfferUseScene(v string) (success bool) {
	switch sqlc.EmOfferUseScene(v) {
	case sqlc.EmOfferUseSceneShoppingCart, sqlc.EmOfferUseSceneOrdering:
		success = true
	}
	return
}

// IsOfferUseSceneArray check []string is []em_offer_use_scene
func IsOfferUseSceneArray(v []string, emptyIsValid bool) (success bool) {
	if emptyIsValid && len(v) == 0 {
		success = true
		return
	}
	success = util.AllString(v, func(s string) bool {
		return IsOfferUseScene(s)
	})
	return
}
